//
//  CHRepairDetailController.m
//  CarFile
//
//  Created by 陈浩 on 2017/4/11.
//  Copyright © 2017年 陈浩. All rights reserved.
//

#import "CHRepairDetailController.h"
#import "CHWXJLViewController.h"
#import "CHDemoViewController.h"
#import "CHComplaintListController.h"
#import "CHRepairHeadView.h"
#import "CHWXQYHeaderView.h"
#import "CHMenuView.h"
#import "CHRepairModel.h"
#import "CHWXQYDetailCell.h"
#import "WX_Model.h"
#import "QYDetailModel.h"
#import "CHRepairHeaderView.h"
#import "CHSatisfactionCell.h"
@interface CHRepairDetailController ()<CHMenuViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ModuleProtocol,LongriseRouterDelegater>


@property (nonatomic ,strong) NSArray *sectionData;
@property (nonatomic ,strong) UIScrollView *mainScrollView;
@property (nonatomic ,strong) UITableView *sj_tableView;
@property (nonatomic ,strong) UITableView *pj_tableView;
@property (nonatomic ,strong) UITableView *ts_tableView;
@property (nonatomic ,strong) CHMenuView *menuView;
@property (nonatomic ,strong) CHRepairHeadView *headView;
@property (nonatomic ,strong) NSMutableArray *datas;
@property (nonatomic ,strong) NSMutableArray *pjDatas;
@property (nonatomic ,strong) NSMutableArray *tsDatas;
@property (nonatomic ,strong) NSArray *times;
@property (nonatomic ,strong) CHRepairHeaderView *headerView;
@property (nonatomic ,copy) NSString *areaid;
@property (nonatomic ,copy) NSString *name;
@property (nonatomic ,copy) NSString *docktime;
@property (nonatomic ,copy) NSString *rate;

@end

@implementation CHRepairDetailController
-(NSMutableArray *)pjDatas{
    if (!_pjDatas) {
        _pjDatas = [NSMutableArray array];
    }
    return _pjDatas;
}

-(NSMutableArray *)tsDatas{
    if (!_tsDatas) {
        _tsDatas = [NSMutableArray array];
    }
    return _tsDatas;
    
}

-(NSMutableArray *)datas{
    if (!_datas) {
        _datas = [NSMutableArray array];
    }
    return _datas;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"维修企业详情";
    self.view.backgroundColor = [UIColor whiteColor];
    // Do any additional setup after loading the view.
    
    CHRepairHeaderView *headerView = [[CHRepairHeaderView alloc] initWithFrame:CGRectMake(0, 0, UIScreenW, 190*ScaleY)];
    headerView.areaid = self.areaid;
    headerView.companyid = self.companyid;
    [self.view addSubview:headerView];
    self.headerView = headerView;
    
    NSArray *titles = @[@"数据详情",@"评价",@"投诉"];
    CHMenuView *menuView =[[ CHMenuView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(headerView.frame), UIScreenW, 40) withTitles:titles];
    menuView.delegate = self;
    menuView.bgColor = [UIColor colorWithHexString:@"eeeef0" alpha:1.0f];
    [self.view addSubview:menuView];
    self.menuView = menuView;
    
    [self setupMainScrollView];
    
    //    [super showLoading:YES];
    
    [BQActivityView showActiviTy];
    
    
    
    [self getSJData];
    [self getPJData];
    [self getTSData];
    
}


- (void)setupMainScrollView{
    UIScrollView *mainScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0,  CGRectGetMaxY(self.menuView.frame), UIScreenW, UIScreenH - CGRectGetMaxY(self.menuView.frame) -64 )];
    mainScrollview.delegate = self;
    mainScrollview.pagingEnabled = YES;
    mainScrollview.scrollEnabled = YES;
    mainScrollview.bounces = NO;
    mainScrollview.showsHorizontalScrollIndicator = NO;
    mainScrollview.showsVerticalScrollIndicator = NO;
    //    mainScrollview.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth;
    [self.view addSubview:mainScrollview];
    
    self.sj_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, UIScreenW, mainScrollview.h) style:UITableViewStylePlain];
    self.sj_tableView.separatorStyle = NO;
    self.sj_tableView.delegate = self;
    self.sj_tableView.dataSource = self;
    //隐藏多余cell
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenW, 120)];
    //    view.backgroundColor = [UIColor redColor];
    self.sj_tableView.tableFooterView = view;
    [mainScrollview addSubview:self.sj_tableView];
    
    
    self.pj_tableView = [[UITableView alloc] initWithFrame:CGRectMake(UIScreenW, 0, UIScreenW, mainScrollview.h) style:UITableViewStylePlain];
    self.pj_tableView.delegate = self;
    self.pj_tableView.dataSource = self;
    self.pj_tableView.separatorStyle = NO;
    self.pj_tableView.tableFooterView = view;
    //隐藏多余cell
    [mainScrollview addSubview:self.pj_tableView];
    
    
    self.ts_tableView = [[UITableView alloc] initWithFrame:CGRectMake(UIScreenW*2, 0, UIScreenW, mainScrollview.h) style:UITableViewStylePlain];
    self.ts_tableView.separatorStyle = NO;
    self.ts_tableView.delegate = self;
    self.ts_tableView.dataSource = self;
    self.ts_tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    [mainScrollview addSubview:self.ts_tableView];
    
    mainScrollview.contentSize = CGSizeMake(UIScreenW *3, 0);
    self.mainScrollView = mainScrollview;
    
}





-(void)getSJData{
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"areaid"] = self.areaid;
    params[@"usertype"] = [Util getValue:@"usertype"];
    params[@"user"] = [Globle getInstance].user;
    params[@"sign"] = [DESCript encrypt:self.companyid encryptOrDecrypt:kCCEncrypt key:[Globle getInstance].key];
    params[@"companyid"] = self.companyid;
    params[@"start"] = [Util getStartTimeWithNumber:6];
    params[@"end"] = [Util getLastDayTime];
    [[Globle getInstance].service requestWithServiceName:@"lcipappgovcompanydatadetails" params:params httpMethod:@"POST" resultIsDictionary:YES completeBlock:^(id result) {
        NSLog(@"企业数据详情%@",result);
        [BQActivityView hideActiviTy];
        if ([result[@"code"] isEqualToString:@"1"]) {
            
            NSDictionary *dict = result[@"data"];
            
            self.docktime = dict[@"docktime"];
            self.times = [NSArray arrayWithArray:dict[@"nouploaddata"][@"time"]];
            NSArray  *titles = [NSArray arrayWithObjects:@"企业总维修记录/日均",@"企业总维修车辆/日均", nil];
            
            NSString *wxjl = [NSString stringWithFormat:@"%@/%@",dict[@"repairnum"],dict[@"repairnumavg"]];
            NSString *wxcl = [NSString stringWithFormat:@"%@/%@",dict[@"repaircarnum"],dict[@"repaircarnumavg"]];
            NSArray  *results =  [NSArray arrayWithObjects:wxjl,wxcl, nil];
            
            NSArray *sectionTitles = nil;
            
            if ([dict[@"docktime"] isEqualToString:@""]) {
                sectionTitles = @[@"已上传",@"累计未上传天数",@"未对接"];
                for (int i = 0; i < sectionTitles.count; i++) {
                    WX_Model *wxmodel = [[WX_Model alloc] init];
                    wxmodel.title = sectionTitles[i];
                    if (i == 0) {
                        wxmodel.iconName = @"upload";
                        NSMutableArray *tempArr = [NSMutableArray array];
                        for (int j = 0; j < results.count; j++) {
                            QYDetailModel *model = [[QYDetailModel alloc] init];
                            model.result = results[j];
                            model.title = titles[j];
                            [tempArr addObject:model];
                        }
                        wxmodel.resultArrs = tempArr;
                        
                    }else if(i == 1){
                        NSMutableArray *arr = [NSMutableArray array];
                        QYDetailModel *model = [[QYDetailModel alloc] init];
                        model.title = @"累计未上传天数";
                        model.result = dict[@"nouploadday"];
                        [arr addObject:model];
                        wxmodel.resultArrs = arr;
                        wxmodel.iconName = @"not_uploaded";
                        
                    }else{
                        
                        NSMutableArray *arr = [NSMutableArray array];
                        QYDetailModel *model = [[QYDetailModel alloc] init];
                        model.title = @"未完成系统对接";
                        [arr addObject:model];
                        wxmodel.resultArrs = arr;
                        wxmodel.iconName = @"network";
                    }
                    [self.datas addObject:wxmodel];
                }
                
            }else{
                sectionTitles = @[@"已上传",@"未上传",@"异常企业管理"];
                for (int i = 0; i < sectionTitles.count; i++) {
                    WX_Model *wxmodel = [[WX_Model alloc] init];
                    wxmodel.title = sectionTitles[i];
                    if (i == 0) {
                        wxmodel.iconName = @"upload";
                        NSMutableArray *tempArr = [NSMutableArray array];
                        for (int j = 0; j < results.count; j++) {
                            QYDetailModel *model = [[QYDetailModel alloc] init];
                            model.result = results[j];
                            model.title = titles[j];
                            [tempArr addObject:model];
                        }
                        wxmodel.resultArrs = tempArr;
                        
                    }else if(i == 1){
                        NSMutableArray *arr = [NSMutableArray array];
                        QYDetailModel *model = [[QYDetailModel alloc] init];
                        model.title = @"累计未上传天数";
                        model.result = dict[@"nouploadday"];
                        [arr addObject:model];
                        wxmodel.resultArrs = arr;
                        wxmodel.iconName = @"not_uploaded";
                    }else{
                        
                        NSMutableArray *arr = [NSMutableArray array];
                        QYDetailModel *model = [[QYDetailModel alloc] init];
                        model.title = @"是否异常企业";
                        if ([dict[@"isexception"] isEqualToString:@"0"]) {
                            model.result = @"是";
                        }else{
                            model.result = @"否";
                        }
                        [arr addObject:model];
                        wxmodel.resultArrs = arr;
                        wxmodel.iconName = @"warning";
                        
                        
                    }
                    [self.datas addObject:wxmodel];
                    
                }
                
            }
            
            [self.sj_tableView reloadData];
        }
    }];
}


-(void)getPJData{
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"areaid"] = self.areaid;
    params[@"usertype"] = [Util getValue:@"usertype"];
    params[@"user"] = [Globle getInstance].user;
    params[@"sign"] = [DESCript encrypt:self.companyid encryptOrDecrypt:kCCEncrypt key:[Globle getInstance].key];
    params[@"companyid"] = self.companyid;
    [[Globle getInstance].service requestWithServiceName:@"lcipappgovsearevaluate" params:params httpMethod:@"POST" resultIsDictionary:YES completeBlock:^(id result) {
        NSLog(@"评价数据详情%@",result);
        if ([result[@"code"] isEqualToString:@"1"]) {
            
            NSArray *sectionTitles = @[@"评价统计",@"企业评价满意度"];
            NSArray *titles = @[@"非常满意",@"满意",@"不满意",@"评价数",@"满意度"];
            NSDictionary *dict = result[@"data"];
            self.rate = dict[@"rate"];
            self.name = dict[@"name"];
            self.areaid = dict[@"areaid"];
            
            int sum = [dict[@"verygood"] intValue] +[dict[@"good"] intValue] +[dict[@"bad"] intValue];
            NSArray *results = @[dict[@"verygood"],dict[@"good"],dict[@"bad"],dict[@"evaluatenum"],dict[@"rate"]];
            
            for (int i = 0; i < sectionTitles.count; i++) {
                WX_Model *wxmodel = [[WX_Model alloc] init];
                wxmodel.title = sectionTitles[i];
                wxmodel.iconName = @"pjtj";
                if (i == 0) {
                    
                    NSMutableArray *tempArr = [NSMutableArray array];
                    for (int j = 0; j < results.count; j++) {
                        QYDetailModel *model = [[QYDetailModel alloc] init];
                        model.result = results[j];
                        model.title = titles[j];
                        [tempArr addObject:model];
                    }
                    wxmodel.resultArrs = tempArr;
                    
                }else{
                    
                    NSMutableArray *arr = [NSMutableArray array];
                    QYDetailModel *model = [[QYDetailModel alloc] init];
                    model.verygood = [NSString stringWithFormat:@"%f",[dict[@"verygood"] floatValue] / (float)sum];
                    model.good = [NSString stringWithFormat:@"%f",[dict[@"good"] floatValue] / (float)sum];
                    model.bad = [NSString stringWithFormat:@"%f",[dict[@"bad"] floatValue] / (float)sum];
                    [arr addObject:model];
                    wxmodel.resultArrs = arr;
                }
                
                [self.pjDatas addObject:wxmodel];
            }
            
            [self.pj_tableView reloadData];
        }
    }];
}



-(void)getTSData{
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"areaid"] = self.areaid;
    params[@"usertype"] = [Util getValue:@"usertype"];
    params[@"user"] = [Globle getInstance].user;
    params[@"sign"] = [DESCript encrypt:self.companyid encryptOrDecrypt:kCCEncrypt key:[Globle getInstance].key];
    params[@"companyid"] = self.companyid;
    [[Globle getInstance].service requestWithServiceName:@"lcipappgovsearcomplaint" params:params httpMethod:@"POST" resultIsDictionary:YES completeBlock:^(id result) {
        NSLog(@" 投诉数据详情%@",result);
        if ([result[@"code"] isEqualToString:@"1"]) {
            NSArray *sectionTitles = @[@"投诉统计"];
            NSArray *titles = @[@"用户投诉数",@"企业处理数",@"投诉处理率"];
            NSDictionary *dict = result[@"data"];
            NSArray *results = @[dict[@"complaintnum"],dict[@"untreatednum"],dict[@"complaintrate"]];
            
            for (int i = 0; i < sectionTitles.count; i++) {
                WX_Model *wxmodel = [[WX_Model alloc] init];
                wxmodel.title = sectionTitles[i];
                wxmodel.iconName = @"tstj";
                if (i == 0) {
                    NSMutableArray *tempArr = [NSMutableArray array];
                    for (int j = 0; j < results.count; j++) {
                        QYDetailModel *model = [[QYDetailModel alloc] init];
                        model.result = results[j];
                        model.title = titles[j];
                        [tempArr addObject:model];
                    }
                    wxmodel.resultArrs = tempArr;
                    
                }
                [self.tsDatas addObject:wxmodel];
                
            }
            [self.ts_tableView reloadData];
        }
    }];
}






#pragma mark - UITableViewDataSource
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    if (tableView == _sj_tableView) {
        return self.datas.count;
    }else if(tableView == _pj_tableView){
        return self.pjDatas.count;
    }else if (tableView == self.ts_tableView){
        return self.tsDatas.count;
    }
    return 0;
}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    if (tableView == self.sj_tableView) {
        WX_Model *model = self.datas[section];
        return  model.resultArrs.count;
    }else if (tableView == self.pj_tableView){
        WX_Model *model = self.pjDatas[section];
        return model.resultArrs.count ;
    }else if (tableView == self.ts_tableView){
        WX_Model *model = self.tsDatas[section];
        return  model.resultArrs.count ;
    }
    
    return 0;
    
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    CHWXQYDetailCell *cell = [CHWXQYDetailCell cellForTableView:tableView];
    if (tableView == self.sj_tableView) {
        if (indexPath.section ==2) {
            
            cell.isJump = NO;
            cell.userInteractionEnabled = NO;
            
        }
        WX_Model *model = self.datas[indexPath.section];
        cell.model = model.resultArrs[indexPath.row];
    }else if (tableView == self.pj_tableView){
        if (indexPath.section == 0) {
            //            if (indexPath.row == 0 || indexPath.row == 1 || indexPath.row == 2) {
            //                cell.isJump = NO;
            //                cell.userInteractionEnabled = NO;
            //            }
            WX_Model *model = self.pjDatas[indexPath.section];
            cell.model = model.resultArrs[indexPath.row];
            
        }else{
            
            if ([self.rate isEqualToString:@"0"]) {
                UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"normalCell"];
                UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake((UIScreenW - 80)/2, 20, 80, 80)];
                imgView.image = [UIImage imageNamed:@"data_null"];
                UILabel *noticeLabel = [[UILabel alloc] initWithFrame:CGRectMake((UIScreenW -100)/2, 100, 100, 30)];
                noticeLabel.textAlignment = NSTextAlignmentCenter;
                noticeLabel.font = [UIFont systemFontOfSize:14];
                noticeLabel.text = @"暂时没有数据";
                noticeLabel.textColor = [UIColor lightGrayColor];
                [cell addSubview:imgView];
                [cell addSubview:noticeLabel];
                return cell;
            }
            
            WX_Model *model = self.pjDatas[indexPath.section];
            CHSatisfactionCell *cell = [CHSatisfactionCell cellForTableView:tableView];
            cell.model = model.resultArrs[indexPath.row];
            return cell;
            
        }
        
    }else if (tableView == self.ts_tableView){
        WX_Model *model = self.tsDatas[indexPath.section];
        cell.model = model.resultArrs[indexPath.row];
    }
    
    return cell;
    
}


-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 44;
}


-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    CHWXQYHeaderView *view = [[CHWXQYHeaderView alloc] initWithFrame:CGRectMake(0, 0, UIScreenW, 44)];
    
    if (tableView == self.sj_tableView) {
        view.model = self.datas[section];
        
    }else if (tableView == self.pj_tableView){
        view.model = self.pjDatas[section];
        
    }else if (tableView == self.ts_tableView){
        view.model = self.tsDatas[section];
        
    }
    
    return view;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    
    if (tableView == self.sj_tableView) {
        
        if (indexPath.section == 0) {
            
            if (indexPath.row == 0 ) {      //   企业维修记录
                
                id obj = [LongriseRouter openURL:@"CHWXJLViewController"];
                if(obj && [obj isKindOfClass:[UIViewController class]])
                {
                    UIViewController *vc = obj;
                    [self.navigationController pushViewController:vc animated:YES];
                }
                
                //判断该类是否可以传参数
                if([LongriseRouter isImplLongriseRouterDelegaterWithObject:obj])
                {
                    id<LongriseRouterDelegater> delegater = obj;
                    if(delegater)
                    {
                        
                        NSMutableDictionary *params = [NSMutableDictionary dictionary];
                        
                        params[@"companyid"] = self.companyid;
                        
                        //进行传值，传入统一的block以供B进行回调
                        [delegater setParams:params block:^(id obj) {
                            
                            
                        }];
                    }
                }
                
                
            }else{
                
                [MBProgressHUD showWarning:@"敬请期待"];
            }
            
        }else if(indexPath.section == 1){
            if (self.times.count > 0) {
                
                id obj = [LongriseRouter openURL:@"CHDemoViewController"];
                if(obj && [obj isKindOfClass:[UIViewController class]])
                {
                    UIViewController *vc = obj;
                    [self.navigationController pushViewController:vc animated:YES];
                }
                
                //判断该类是否可以传参数
                if([LongriseRouter isImplLongriseRouterDelegaterWithObject:obj])
                {
                    id<LongriseRouterDelegater> delegater = obj;
                    if(delegater)
                    {
                        NSMutableDictionary *dict= [NSMutableDictionary dictionary];
                        dict[@"time"] = self.times;
                        
                        //进行传值，传入统一的block以供B进行回调
                        [delegater setParams:dict block:^(id obj) {
                            
                            
                        }];
                    }
                }
            }
        }
        
    }else if (tableView == self.pj_tableView){
        
        
        if (indexPath.section == 0) {
            
            if (indexPath.row == 3 ) {
                
                id obj = [LongriseRouter openURL:@"CHQYPJViewController"];
                if(obj && [obj isKindOfClass:[UIViewController class]])
                {
                    UIViewController *vc = obj;
                    [self.navigationController pushViewController:vc animated:YES];
                }
                
                //判断该类是否可以传参数
                if([LongriseRouter isImplLongriseRouterDelegaterWithObject:obj])
                {
                    id<LongriseRouterDelegater> delegater = obj;
                    if(delegater)
                    {
                        
                        NSMutableDictionary *params = [NSMutableDictionary dictionary];
                        
                        params[@"areaid"] = self.areaid;
                        params[@"name"] = self.name;
                        params[@"companyid"] = self.companyid;
                        params[@"start"] = self.docktime;
                        
                        //进行传值，传入统一的block以供B进行回调
                        [delegater setParams:params block:^(id obj) {
                            
                            
                        }];
                    }
                }
                
            }else{
                
                [MBProgressHUD showWarning:@"敬请期待"];
            }
        }
        
        
        
        
    }else if (tableView == self.ts_tableView){
        
        
        if (indexPath.section ==0) {
            if (indexPath.row == 0) {
                
                id obj = [LongriseRouter openURL:@"CHComplaintListController"];
                if(obj && [obj isKindOfClass:[UIViewController class]])
                {
                    UIViewController *vc = obj;
                    [self.navigationController pushViewController:vc animated:YES];
                }
                
                //判断该类是否可以传参数
                if([LongriseRouter isImplLongriseRouterDelegaterWithObject:obj])
                {
                    id<LongriseRouterDelegater> delegater = obj;
                    if(delegater)
                    {
                        
                        NSMutableDictionary *params = [NSMutableDictionary dictionary];
                        params[@"companyid"] = self.companyid;
                        params[@"areaid"] =  self.areaid;
                        params[@"starttime"] = self.docktime;
                        params[@"endtime"] = [Util getCurrentTime];
                        //进行传值，传入统一的block以供B进行回调
                        [delegater setParams:params block:^(id obj) {
                            
                            
                        }];
                    }
                }
                
            }else{
                [MBProgressHUD showWarning:@"敬请期待"];
            }
            
        }
    }
}




// 必须写的方法，和editActionsForRowAtIndexPath配对使用，里面什么不写也行
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
}

//uitableview处理section的不悬浮，禁止section停留的方法，主要是这段代码
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    
    CGFloat sectionHeaderHeight = 50;
    if(scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {
        scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
    } else if (scrollView.contentOffset.y>=sectionHeaderHeight) {
        scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
    }
}



#pragma mark - UIScrollViewDelegate
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    
    if (scrollView == self.mainScrollView) {
        
        int tag = (int)scrollView.contentOffset.x/self.view.size.width +100 ;
        
        UIButton *btn = (UIButton *)[self.menuView viewWithTag:tag];
        
        
        [self.menuView titleBtnClick:btn];
    }
    
}


#pragma mark - CHMenuDelegate
-(void)CHMenuView:(CHMenuView *)menuView didBtnClickWithTag:(NSInteger)tag{
    
    
    [self.mainScrollView setContentOffset:CGPointMake(( tag - 100) *UIScreenW, 0) animated:NO];
    
}

#pragma mark LongriseRouterDelegater代理回调方法
-(void)setParams:(id)obj block:(LongriseRouterBlock)block
{
    if (obj && [obj isKindOfClass:[NSMutableDictionary class]]) {
        
        NSMutableDictionary *dict = obj;
        self.companyid = dict[@"companyid"];
        self.areaid = dict[@"areaid"];
        
    }
}







@end
